<template>
  <div class="my-page page">
    <nav-bar :title="title" theme="red" message></nav-bar>
    <div class="my-list">
      <van-cell
        v-for="(item, key) in listData"
        :key="key"
        @click="$router.push(item.path)"
        size="large"
        title-class="title-margin"
        :icon="item.iconPath"
        :title="item.text"
        is-link
        :border="false"
      ></van-cell>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      List: [
        {
          id: 'wish',
          text: '党员心愿',
          iconPath: require('@/assets/images/partyBuilding/service_my_wish@2x.png'),
          path: '/partyBuilding/My/Wish'
        },
        {
          id: 'myAct',
          text: '我的活动',
          iconPath: require('@/assets/images/partyBuilding/service_my_activity@2x.png'),
          path: '/partyBuilding/My/Act'
        }
      ]
    }
  },
  computed: {
    ...mapState({
      user: state => state.userInfo
    }),
    title() {
      return this.user.politic ? this.user.politicName : '群众'
    },
    listData() {
      return this.user.politic === '01' ? this.List : this.List.filter(o => o.id === 'myAct')
    }
  }
}
</script>

<style lang="less" scoped>
@import '~@/assets/style/partyBuilding/My/index.less';
</style>
